<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="Kate, the KDE Advanced Text Editor" />
<title>simulation.bop</title>
</head>
<body>
<pre>
<span style="font-style: italic;color: #808080;">// ================================================== //</span>
<span style="font-style: italic;color: #808080;">// ============ TUTORIELS BEBOP 1.0 ================= //</span>
<span style="font-style: italic;color: #808080;">// ================================================== //</span>

<span style="font-style: italic;color: #808080;">// Net list d'une montre digitale pipee avec un cadran</span>
<span style="font-style: italic;color: #808080;">// graphique avec des afficheurs 7-segments</span>

<span style="font-style: italic;color: #808080;">// On reprend la meme frequence que dans montre.bop</span>
<span style="color: #008000;">#define FREQ 2</span>

<span style="font-style: italic;color: #808080;">// On specifie le lien vers l'application cadran et montre</span>
<span style="color: #008000;">#define PATH "./"</span>

<span style="font-style: italic;color: #808080;">// Une fonction de simulation qui encapsule les appels systemes.</span>
<span style="font-style: italic;color: #808080;">// la syntaxe $(...) permet d'acceder aux variables #define</span>

<span style="font-style: italic;color: #808080;">// L'option -m de freq permet de faire comme si on avait lancée l'application à minuit</span>
<span style="font-style: italic;color: #808080;">// Pendant un temps, la simulation s'emballe, puis se stabilise à l'heure courante.</span>

<span style="color: #000000;">simulation_native () = ()</span>
<span style="color: #000000;">where</span>
<span style="color: #000000;">	= pipe(</span><span style="color: #dd0000;">"$(PATH)cadran"</span><span style="color: #000000;">, pipe[</span><span style="color: #0000ff;">42</span><span style="color: #000000;">](</span><span style="color: #dd0000;">"$(PATH)montre"</span><span style="color: #000000;">, pipe[</span><span style="color: #0000ff;">1</span><span style="color: #000000;">](</span><span style="color: #dd0000;">"./freq.bpix -m -f $(FREQ)"</span><span style="color: #000000;">)));</span>
<span style="color: #000000;">end where;</span>

<span style="color: #000000;">simulation () = ()</span>
<span style="color: #000000;">where</span>
<span style="color: #000000;">	 = pipe(</span><span style="color: #dd0000;">"$(PATH)cadran"</span><span style="color: #000000;">, pipe[</span><span style="color: #0000ff;">42</span><span style="color: #000000;">](</span><span style="color: #dd0000;">"bopsimu montre.bop -p"</span><span style="color: #000000;">, pipe[</span><span style="color: #0000ff;">1</span><span style="color: #000000;">](</span><span style="color: #dd0000;">"./freq.bpix -m -f $(FREQ)"</span><span style="color: #000000;">)));</span>
<span style="color: #000000;">end where;</span></pre></body>
</html>
